<template>
  <div>
    <div
    v-if="this.lishilist"
      class="box"
      @click="
        $router.push({
          path: '/xiangqing',
          query: { id: `${lishilist.cook_id}` },
        })
      "
    >
      <div class="left">
        <van-image
          width="100rem"
          height="90rem"
          fit="cover"
          :src="this.lishilist.photo_path"
        />
      </div>
      <div class="right">
        <h1>{{ lishilist.title }}</h1>
        <div class="xingrong" v-html="lishilist.cookstory"></div>
        <div class="hz">
          <p>{{ lishilist?.views_count_text }}人收藏</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Vue from "vue";
import { Image as VanImage } from "vant";

Vue.use(VanImage);
export default {
  props: ["item"],
  data() {
    return {
      lishilist: [],
    };
  },
  created() {
    this.axios
      .get(`https://apis.netstart.cn/douguo/recipe/detail/${this.item.cid}`)
      .then((res) => {
        this.lishilist = res?.data?.result?.recipe;
        // console.log("cid",this.lishilist.cook_id);
      });
  },
};
</script>

<style lang="scss" scoped>
.van-image {
  img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
  }
}
.box {
  display: flex;
  .right {
    width: 240rem;
    height: 100rem;
    position: relative;
    h1 {
      font-size: 14rem;
      font-weight: 700;
      margin: 15rem 0 0 10rem;
      color: #777;
    }
    .xingrong {
      // height: 30rem;
      width: 230rem;
      margin: 5rem 0 0 10rem;
      font-size: 12rem;
      overflow: hidden;
      -webkit-line-clamp: 2;
      display: -webkit-box;
      -webkit-box-orient: vertical;
    }
    .hz {
      position: absolute;
      bottom: 10rem;
      left: 10rem;
    }
  }
}
</style>
